package JFrame;

import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class GridLayoutDdemo {
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		JPanel panel = new JPanel();
		frame.add(panel);
		
		
		panel.setLayout(new GridLayout(4, 5));
		
		JButton[] buttons = new JButton[20];
		for (int i = 0; i < buttons.length; i++) {
			buttons[i] = new JButton((i + 1)+ "");
		}
		for (int i = 0; i < buttons.length; i++) {
			panel.add(buttons[i]);
		}

		

		
		
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(300, 300);
		frame.setTitle("BorderLayiut_Test");
		frame.setLocation(500, 400);
		frame.setVisible(true);
	}
}
